package org.itsolutions.javaBackup.bootstrapping;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;

import org.itsolutions.javaBackup.exceptions.AException;
import org.itsolutions.javaBackup.ioc.AJavaBackupModule;
import org.itsolutions.javaBackup.spi.EModule;
import org.itsolutions.javaBackup.spi.core.INodeContextProvider;

import com.google.inject.Inject;

/**
 * 
 * @author Tomas Fecko
 */
public final class NodeContextProvider implements INodeContextProvider {

	private final ModuleLoader	mModuleLoader;

	/**
	 * 
	 * @param pModuleLoader module loader
	 */
	@Inject NodeContextProvider(ModuleLoader pModuleLoader) {
		mModuleLoader = pModuleLoader;
	}

	@Override
	public List<EModule> getBootedModulesAsList() {
		return new ArrayList<EModule>(mModuleLoader.getBootedModules());
	}

	@Override
	public EnumSet<EModule> getBootedModules() {
		return mModuleLoader.getBootedModules();
	}	

	
	@Override
	public boolean isModuleLoaded(EModule pModule) {
		return mModuleLoader.isModuleLoaded(pModule);
	}
	
	/**
	 * 
	 * @return module instances
	 * @throws AException any exception
	 */
	public List<AJavaBackupModule> getModuleInstances() throws AException {
		return mModuleLoader.getModuleInstances();
	}
}




